<!DOCTYPE html> 
<html> 
    <head > 
    <link rel="stylesheet" href="/static/jquery.mobile-1.0a2/jquery.mobile-1.0a2.min.css" />
    <script src="/static/jquery.min.js"></script>
    <script src="/static/jquery.mobile-1.0a2/jquery.mobile-1.0a2.min.js"></script>
  <script src="/static/jquery.jeditable.js" type="text/javascript"></script>
  
  <script type="text/javascript">
$(document).ready(function() {
     $('.edit1').editable('/courses/editlecturename/{{lecture.id}}/', {
     	style: 'display: inline',
     	callback : function(value, settings) {
         $('#sideNoti').load('/quiz/lecture/prepare/{{lecture.id}}');
    }
     	
     	
     });
});

jQuery(document).ajaxSend(function(event, xhr, settings) {
    function getCookie(name) {
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
    function sameOrigin(url) {
        // url could be relative or scheme relative or absolute
        var host = document.location.host; // host + port
        var protocol = document.location.protocol;
        var sr_origin = '//' + host;
        var origin = protocol + sr_origin;
        // Allow absolute or scheme relative URLs to same origin
        return (url == origin || url.slice(0, origin.length + 1) == origin + '/') ||
            (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') ||
            // or any other URL that isn't scheme relative or absolute i.e relative.
            !(/^(\/\/|http:|https:).*/.test(url));
    }
    function safeMethod(method) {
        return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
    }

    if (!safeMethod(settings.type) && sameOrigin(settings.url)) {
        xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
    }
});
</script>
  
</head> 
<body>

<div data-role="page" > 
   
    <div data-theme="c" data-role="navbar">
	<ul>
<li><a onClick="$('#sideNoti').load('/courses/{{course.id}}/lectures/');" href='#'  class="ui-btn-active ui-state-persist" >Lectures</a></li>
				<li><a    href="#"  onclick="$('#sideNoti').load('/quiz/stpage/{{course.id}}')" >Statistics</a></li>

	</ul>
</div>  
  <div data-role="content" data-theme="b">
  <h2 style=" color:#333333"><div class="edit1" id="title" title="click to edit!!!" name="title">{{lecture.title}}</div></h2> 
<ul data-role="listview" data-theme="g" data-inset="true" >
<li> <a rel="external" href='/quiz/lecture/start/{{lecture.id}}' > Start this Lecture</a></li>
<li><a rel="external" href='/quiz/{{lecture.id}}/create'> Create Quiz</a>
</li>
</ul>
{% if quizes %}
<h2 style=" color:#333333"> Previously created quizzes in that lecture:</h2>

<ul data-role="listview" data-theme="m" data-inset="true" >
{% for quiz in quizes %}
<li>{{quiz.title}}</li>
{% endfor %}
</ul>
{% endif %}
</div></div>
</body>
</html>
